package com.ems.mapper;

import com.ems.entity.TRoler;
import com.ems.entity.TUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ems.entity.TUserRole;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ZZH
 * @since 2022-06-27
 */
@Mapper
public interface TUserMapper extends BaseMapper<TUser> {

    //增加数据
//    @Insert("insert into t_user(id,user_name,password,remarks,real_name,del_flag,creator,updater) values (#{id},#{userName},#{password},#{remarks},#{realName},#{delFlag},#{creator},#{updater})")
    public Boolean add1(TUser tUser);

    public Boolean add2(@Param("userName")String f,@Param("roleId")Integer g,@Param("creator")String d,@Param("remarks")String e);


    //删除数据
//    @Delete("delete from t_user where id = #{id}")
    public Boolean delete(String userName);

    public Boolean delete2(String userName);

    //修改数据
//    @Update("update t_user set user_name = #{userName}, password = #{password}, remarks = #{remarks}, real_name = #{realName}, del_flag = #{delFlag}, creator = #{creator}, updater = #{updater} where id = #{id}")
    public Boolean update1(TUser tUser);

    public Boolean update2(@Param("userName") String i,@Param("roleId") Integer j,@Param("creator")String a,@Param("updater")String b,@Param("remarks")String c);

    //查找数据(单)
//    @Select("select * from t_user where id = #{id}")
    public TUser findOne(String userName);

    //查找数据(全)
//    @Select("select * from t_user")
    List<TUser> findAll();

    //登录获取用户名密码
    public TUser login(@Param("userName")String userName,@Param("password")String password);

    //注册
    public void register(TUser tUser);

    public void register2(@Param("userName")String q,@Param("roleId")Integer w,@Param("creator")String r);

    //注册验证
    public TUser registerTest(@Param("userName")String userName);
}
